package co.com.fperez.navegar;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class NavegarURLProxy {

		
	public static void main(String[] args) {
	
		Proxy proxy = null;
		WebClient webClient = new WebClient();
		
		
		proxy = new Proxy();
				
		//proxy.setServidor( "124.238.252.150" );
		//proxy.setPuerto( "80" );
		
		/*
		webClient.setProxy(proxy);		
		*/
		
		String resultado = null;
		
		//NavegarURLProxy navegarURLProxy = new NavegarURLProxy();
				
		try {
			
			//webClient.setProxy(proxy);
			
			//webClient.rapidShare();
			
			webClient.leerProxyes();
			
			//System.err.println( "Proxy: " + proxy.getServidor() + ":" + proxy.getPuerto() );
			
			//resultado = webClient.doGet( "http://www.cualesmiip.com/" );
			//resultado = webClient.doGet( "http://www.gmail.com" );
			//resultado = webClient.doGet( "http://xataca.com" );
			
			//System.err.println( "Resultado: " + resultado );
			
		}  catch (IOException e1) {
			e1.printStackTrace();
		} catch (Exception e1) {
			e1.printStackTrace();
		}
		
		/*		
		String rutaProxy = "src/co/com/fperez/navegar/proxy.properties";
		MiProperties miProperties = null;
		Entry<Object, Object> entry = null;
		Set<Entry<Object, Object>> set  = null;
		Iterator<Entry<Object, Object>> it = null;
		
		ArrayList<Proxy> proxyList = new ArrayList<Proxy>();
		
		try {
			
			miProperties = MiProperties.getInstance(rutaProxy);
			set = miProperties.getProxyList();
			
			if( set != null ) {
				
				it = set.iterator();
				
				while( it.hasNext() ) {
					entry = it.next();
					proxy = new Proxy();
					proxy.setServidor( entry.getKey().toString() );
					proxy.setPuerto( entry.getValue().toString() );
					proxyList.add( proxy );
					System.err.println( entry.getKey() + " : " + entry.getValue());
				}
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		*/
	}
}
